import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    component: () => import('../views/login.vue')
  },
  {
    path: '/register',
    component: () => import('../views/register.vue')
  },
  {
    path: '/echarts',
    component: () => import('../layouts/MainLayout.vue'),
    meta: { name: '业务管理' },
    children: [
      {
        path: '',
        redirect: { path: 'ePage1' }
      },
      {
        path: 'ePage1',
        component: () => import('../views/echarts/ePage1.vue'),
        meta: { name: 'ePage1' }
      },
      {
        path: 'ePage2',
        component: () => import('../views/echarts/ePage2.vue'),
        meta: { name: 'ePage2' }
      },
      {
        path: 'ePage3',
        component: () => import('../views/echarts/ePage3.vue'),
        meta: { name: 'ePage3' }
      }
    ]
  },
  {
    path: '/user',
    component: () => import('../layouts/MainLayout.vue'),
    meta: { name: '基础信息' },
    children: [
      {
        path: '',
        redirect: { path: 'userList' }
      },
      {
        path: 'userList',
        component: () => import('../views/user/userList.vue'),
        meta: { name: '用户列表' }
      },
      {
        path: 'addUser',
        component: () => import('../views/user/addUser.vue'),
        meta: { name: '新增用户' }
      },
      {
        path: 'modUser',
        name: '修改用户',
        component: () => import('../views/user/modUser.vue'),
        meta: { name: '修改用户' }
      }
    ]
  },
  {
    path: '/menu',
    component: () => import('../layouts/MainLayout.vue'),
    meta: { name: '基础信息' },
    children: [
      {
        path: '',
        redirect: { path: '/user' }
      },
      {
        path: 'menuList',
        component: () => import('../views/menuList.vue'),
        meta: { name: '菜单管理' }
      }
    ]
  }
]

const router = new VueRouter({
  routes
})

export default router
